<!-- 1、创建MyPromise类
2、构造器传入一个函数，立即执行
3、函数有两个参数，分别是resolve和reject
4、resolve和reject都是函数 -->

<script>
  class MyPromise{
    constructor(executor){
      const resolve = (result)=>{
        console.log('result:',result)
      }
      const reject = (result)=>{
         console.log('result:',result)
      }
      executor(resolve,reject)
    }
  }

  const p1 = new MyPromise((resolve, reject) => {
    resolve(1)
  })
</script>